/* 
 * File:   states.h
 * Author: craigjb
 *
 * Created on April 15, 2013, 3:57 PM
 */

#ifndef STATES_H
#define	STATES_H

#ifdef	__cplusplus
extern "C" {
#endif

#define PRIMARY_STATE_UNKNOWN 0
#define PRIMARY_STATE_INIT 1
#define PRIMARY_STATE_SEARCH_IR 2
#define PRIMARY_STATE_FOLLOW_TAPE 3
#define PRIMARY_STATE_TURN_180 4
#define PRIMARY_STATE_MIDDLE_CIRCLE 5
#define PRIMARY_STATE_DO_NOTHING 6
#define PRIMARY_STATE_LEAVE_TAPE 7

/* Declaration of global variable holding the current high-level state */
extern int g_CurrentPrimaryState;

/* Switches the current high-level state */
void SetCurrentPrimaryState(int newState);

int GetCurrentPrimaryState();

/* Declaration for the initialization state */
void PrimaryStateInit(void);

/* Declaration for the IR search phase state */
void PrimaryStateSearchIR(void);

/* Declaration for the tape-following phase state*/
void PrimaryStateFollowTape(void);

/* Declaration for the turn 180 degrees state*/
void PrimaryStateTurn180(void);

/* Declaration for state that drives to middle of circle */
void PrimaryStateMiddleCircle(void);

/* Controls leaving the tape after IR source aquisition */
void PrimaryStateLeaveTape(void);

#ifdef	__cplusplus
}
#endif

#endif	/* STATES_H */
